// company/fabu_management/fabu_management.js
const app = getApp(), core = require('../../utils/core'),chatIM = require('../../utils/websocket.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    receive_user_id:0, 
    show:true,
    jobs: [],
    showPromoteTip: false,
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({receive_user_id:options.receive_user_id})
    this.refresh();
  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  },
  refresh: function () {
    this.setData({jobs:[]});
    core.get({
      url: '/xilujob.job/chat_job_lists', data: {receive_user_id:this.data.receive_user_id}, success: ret => {
        this.setData({jobs: ret.data});
      }
    });
  },
  bindSendJob(e){
	  let jobId = e.currentTarget.dataset.id;
	  chatIM.sendMessage(this.data.receive_user_id, jobId,3);
	  wx.navigateBack();
  }
});
